package com.ss.android.article.base.ui;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.EditText;
import com.ss.android.common.app.LifeCycleInvoker;
import com.ss.android.common.app.LifeCycleMonitor;
import java.lang.reflect.Array;
import java.lang.reflect.Field;

public class SafetyEditText extends EditText implements LifeCycleMonitor {
    private static Field a;

    static {
        Field v0 = null;
        try {
            v0 = Class.forName("android.text.TextLine").getDeclaredField("sCached");
            v0.setAccessible(true);
        }
        catch(Exception v1) {
        }

        SafetyEditText.a = v0;
    }

    public SafetyEditText(Context arg1) {
        super(arg1);
        this.a(arg1);
    }

    public SafetyEditText(Context arg1, AttributeSet arg2) {
        super(arg1, arg2);
        this.a(arg1);
    }

    public SafetyEditText(Context arg1, AttributeSet arg2, int arg3) {
        super(arg1, arg2, arg3);
        this.a(arg1);
    }

    private void a(Context arg2) {
        if((arg2 instanceof LifeCycleInvoker)) {
            ((LifeCycleInvoker)arg2).registerLifeCycleMonitor(((LifeCycleMonitor)this));
        }
    }

    public final void onDestroy() {
        Object v1;
        Object v2 = null;
        if(SafetyEditText.a != null) {
            try {
                v1 = SafetyEditText.a.get(null);
            }
            catch(Exception v0) {
                v1 = v2;
            }

            if(v1 == null) {
                return;
            }

            int v0_1 = 0;
            int v3 = Array.getLength(v1);
            while(v0_1 < v3) {
                Array.set(v1, v0_1, v2);
                ++v0_1;
            }
        }
    }

    public final void onResume() {
    }

    public final void onPause() {
    }

    public final void onStop() {
    }
}

